﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;

namespace FeedReader.Shared.Workers
{
    class UpdateWorker
    {
        CloudStorageAccount acc;

        public UpdateWorker(CloudStorageAccount theacc)
        {
            acc = theacc;
        }

        public void UpdateFeeds(FeedsCollection feeds)
        {
            FeedFetcher fetcher = new FeedFetcher();
            StorageWorker storeworker = new StorageWorker(acc);

            foreach(Feed feed in feeds){

                Feed innerfeed = fetcher.FetchFeed(feed.URL);

                storeworker.StoreUpdateFeed(innerfeed);
            }
        }
    }
}
